/**
 * 表单验证
 * 
 * @param {Object} rules 验证字段的规则
 * @param {Object} messages 验证字段的提示信息
 * 
 */
import basic from './basic.js';
var actmodel = new basic();
// actmodel.tabprooffset = function (that, reset, para, xcsorts) { 
//   if(!xcsorts)
//   {
//     xcsorts=[["id", "desc"], ["createtime", "desc"]] ;
//   }
 
//   var acturlpara = {};   
//   acturlpara["url"] = "entry/wxapp/diy_index"
//   para["plugin"] = "diy"
  
//   if (para) {
//     para["op"] = "tabprooffset"
//   }
//   else {
//     this.wherepara["op"] = "tabprooffset"
//   }
//   return actmodel.pagelist(acturlpara, that, reset, para, xcsorts);
// }

actmodel.getrecord = function (model) {
  var app = getApp();
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/integral_sign',
      showLoading: false,
      'data': { "op": "getrecord",model:JSON.stringify(model),plugin:'integral' },
      'method': "post",
      success: function (res) {
        var reslutmodel = res.data.data;
        resolve(reslutmodel);
      },
      fail: function (res) {
        resolve({ status: -1, "message": "操作失败2" });
      },
      complete: function () {
      }
    },true);
  })
} 
actmodel.gettaskstatus = function () {
  var app = getApp();
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/integral_sign',
      showLoading: false,
      'data': { "op": "gettaskstatus",plugin:'integral' },
      'method': "post",
      success: function (res) {
        var reslutmodel = res.data.data;
        resolve(reslutmodel);
      },
      fail: function (res) {
        resolve({ status: -1, "message": "操作失败2" });
      },
      complete: function () {
      }
    },true);
  })
} 
actmodel.finishtask = function (keyval) {
  var app = getApp();
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/integral_sign',
      showLoading: false,
      'data': { "op": "finishtask",keyval,plugin:'integral' },
      'method': "post",
      success: function (res) {
        var reslutmodel = res.data.data;
        resolve(reslutmodel);
      },
      fail: function (res) {
        resolve({ status: -1, "message": "操作失败2" });
      },
      complete: function () {
      }
    },true);
  })
} 
actmodel.signin = function () {
  var app = getApp();
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/integral_sign',
       showLoading: false,
      'data': { "op": "signin",plugin:'integral' },
      'method': "post",
      success: function (res) {
        var reslutmodel = res.data.data;
        resolve(reslutmodel);
      },
      fail: function (res) {
        resolve({ status: -1, "message": "操作失败2" });
      },
      complete: function () {
      }
    },true);
  })
} 

actmodel.getcores = function (key) {
  var app = getApp();
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/integral_sign',
       showLoading: false,
      'data': { "op": "getcores",key,plugin:'integral' },
      'method': "post",
      success: function (res) {
        var reslutmodel = res.data.data;
        resolve(reslutmodel);
      },
      fail: function (res) {
        resolve({ status: -1, "message": "操作失败2" });
      },
      complete: function () {
      }
    },true);
  })
} 
module.exports = actmodel;



